fixed numerous serialisation issues