improve cli robustness