gen query's bug