Fix query error in 40_scope