Fixed self-colliding bug

Thanks to nont for reporting this bug