Improve test map. Add tests. Fix a bug in collision with corner.