remove unused dynamic var and related dead code