Fix for NullReferenceException.