i think this condition should be before the else part or even the if (line 35)