fixed bug related to gridmap file writing