changed checking of files in temp directory to no longer rely on order.