adding exits on error