Fixed bug when writing empty maps