Fixed db exception handler