error handling support added on database.py