bug fixes, created logging functionality for database errors