Fixes for both cleanscans and rescan functions