add some cli tests and fix server to use tvar for state