some fixes, most tests pass now