more tests + fix bugs