Try to add some debugging to see what is the issue