Fixing database issues