Little fix to stop smoothing going outside the bounds of the frame