Yoy will have to show some code, as the problem can be anything, and without seeing your code; it is way too difficult to exactly tell you where the problems are.