bugfix with state 4 getting stuck at midpoint