Actually I only check for None first, but two test cases in '2, cms-acceptance' fails. Then I changed to this code and it works fine with the test cases.