better handling of boundaries for move (especially in small maps)