better way to check if files exist