Fix bug when smoothing