fixed error in datatypes.serialize()

This one was preventing objects to serialize to strings and crashing the app when it tried to.