added more code to cases on new_scan. fixed bugs.