fixed some test cases and added a raise of state update