fixed too many calls to error.new