Fix helper_functions to exit and show log on error