Trying to track down an error with terrible error reporting