Scanner enhancments master

this pull request tries to fix #5264