Fix double database lookup