fix NPE under some circumstances (getElementsAnnotatedWith returns garbage)