Fixing various serialization issues