added mysql error handler