some DB error handling added