Fixed errors on map generation (to be continued)