The fact you have solved your problem does NOT mean you may remove the source code(where the problem was) from your OP!
Without that code al your thread does not make any sense!

Please, restore your original code and share your solution.