fixed wrong state change,
fixed wrong frame and offset changes