Fix for maps failing to write under certain circumstances where they should