Fixing incorrect test and correcting the exit code