fix bug where it is sometimes impossible to beat some levels