Fixed bug in generate map