Improve HashMap/ArrayList serialization