fixed a state passing bug