improve DB error handling