remove the function parameter for hook functions
call the end hook before freeing the job