some fixes and cli support added