fix NPE due to factory not being bound on query