border calculation bug fix