Fix double database hit

Fix for issue #242