Yes, I just worked that out. It's the integer math that's the problem. I guess this has been fixed in python 3, but unfortunately it seems that most people are still using python 2. Thanks for all the help!