Fix bug in nextmap generation