various small fixes (now passing tests)