more testcases and corrections