Fixed bug where saving a map that has a diff layer fails. Also catching other similar cases