Fixed program crashing outside VS