added "__set_state" method