implement getstate and setstate for Mono