change throw calls to done(new Error)