Fixing hashFiles function to work in multiple cases