fix all the warnings and test cases