Attempting to fix call to query on non-object.