better collision detection, but getting a segfault error