Add isDisposed checking to avoid unexpected NPE