enough simple bugfixes to make test_simple_system test pass