fixed error in middleware, changed image hosting