Minor bugfixes, fix with test serialization