adding tests, fixing bugs for release