fix can't get the right end state