a lot of serialization fixes