fix serialization bug, tags were not being written out correctly