correcting if condition