Check for proper imports. These were causing stacktraces on Windows.

@basepi, please cherry pick to 0.17 and the RC