Fixed several bugs with map generation