improve the exit code for the functions