fixed serialization of mode