Added try function for correct exit codes