[shell mode] add tests, some fixes