Issue with input files in random order fixed