Fix error clearing for use_tmp_dh functions