Fix to use type.kind == OBJECT instead of VARIABLE