fixes to commands + unit tests to commandtemplate