Fix cli bugs from pull22

Sorry. I introduced some bugs into your repo in pull #22. This pull fixes those bugs.