Fix bug in map serialisation