Added sanity check for loggable_query variable