SW-98. Minor fixes for Windows, and add debug mode

Fixes allow running UI for an sdist build.
Debug mode add extra logging; taken from SW-113.