fixed conditionals, so exit occurs properly