Support beforeQuery