Fixed bug for optional command handling