Fixed some bugs in commander.cpp - it is tested!