correct if block logic