check to see if files exist first