improve an error message when the function is not found
copy function definitions for do_block for function templates