Fixed database connection errors and other minor issues.