fixed warnings and test cases