Test fixes

- fix test in factory
  + fix logic error in XML processing, only mark the first type found
    as the first type. While the flag indicator was set to 0 at the end of
    the loop it was re-initialized with 1 at the beginning of the loop
- fix latent test bug
  + the order of calls was incorrect, thus when a file system tool
    was not present the test reacted to the output from the test itself,
    rather than from the code under test