more tests cases and a fix