Fixed several bugs with scrub function