Fixed close down NullReference error.