Fixed activities' query bugs.