Sweep calculation bugfix