Some fixes on code and some more failure test cases.