check for hooks existence before using it.
load to use closure to construct query object.