work on state restore