fix many cases in which Ast.isEntity does / does not return wrong value