more test cases + fixes