added some error handlers