fix cmd output parameter parsing and improve error report

Change-Id: If20867e8d0e27d2e4b7b33df364ea63e3ce92d77