*scan commands bug fix; add more tests