Correcting invalid conditional check