some bug fixes in CLI