Fix NPE on Windows, and logging.