fix a bug in optimize keywords count