fix bug in ace (border case), add test case