Move virtual filesystem check out of loop.

Thanks to Emmanuel Touzery.