fix freemem bug & try implement correct collision

-free memory bug at line 161-162 fixed
- try to implement correct collision response