fixed wrong if condition