Fix error with $raw_query being an object when checking for array key