Fix some bugs with map rendering.