Bug fixes

These commits fix a couple of bugs with the CLI script, including one I created an issue for earlier today