fixed the bug that failed the last test case