added error checking and error reporting for fidh