Finally fixing the if and exit value