Fixed a bug in the scrub code