Fix virtual path matching for patterns like "filename.*"
Fix misplaced variable declaration