Fix compile warning and test case