Removes unused variables from error functions