fix cli to handle err