fixed tests (and tested code)