consistency check and scanning are fixed, some more logging added