Expand the statement if(floor < alt) with examination of floor, like this if(floor < alt && floor > 0 && floor < 3).
you can tune the constant value 3 to guess out which value is fit for you.