Bug fixes and CLI