Improved dao.py error handling.