Another attempt at NullReferenceException fixing