Bug fix: correctly starting and ending maps.