Various import and logging fixes (rebased onto develop)

See gh-2043 for testing details.

--rebased-from #2043