fixed collision detection. python
merged with vishnu's control code