Fix bug where commands were stored with a space appended

Signed-off-by: Ian Macalinao <ianmacalinao@gmail.com>