simplifying reference type check