Bug fixes for larger map sizes