Fix function errors. Pass 101/101 test cases.