Add type checks and GC guards before accessing the query options hash in the result object. See #321.