Fixed control logic bug