refix according to Paul's suggestion and add expected test case for future use