Rewrited collision handling, fix issue #1