As your code is not complete and reproducable (several key definitions and the mesh is missing), it is very hard for people to assist you.
Please follow the guidelines in: Read before posting: How do I get my question answered?
and make sure that the issues you are getting are reproducable, i.e. that anyone can run the posted code and obtain the same results as you.