add tests + fix bugs
merge