fix after merge
Using isTopLevelDeclaration instaed of a direct instanceof check