Added more null checks for interop.