Fixed a bug for sweeping