Added flush after debug.
Better Windows server support in constructor.