fix graph query bugs for annotation with multiple targets

@wmene