Try adding some print statements to figure out where the program is going.