add magic function __set_state