Some changes to avoid jerk when adding border.