Fixing database references