fixing bug with an even longer if