fixed NPEs when trying to find PSI elements for unresolved references