Fix test_scan which is getting stuck on Travis