Lots of fixes for interoptability between CLI and GUI usage.