fixed bug in model serialization