Fixed two NullReferenceException