Fixed a NullReference issue

Fixed a NullReference issue