How are you trying to debug the code? Add some print statements in the copy method that print out the contents of variables as the method is executed.

Please edit your post and wrap your code...