Fixed serialize to be compatible with scm