CLI and bug fixes