Fixed NullReferenceException when printing to main