add error handler, change common to loader, and change midleware foo