fix the bug for the scan part