fixed couple of small bugs; now at least some tests pass