add error handlers
fix merge conflict