Updated query exception handling and storage consistency

Signed-off-by: Tom Wright <tom@inflatablecookie.com>