Fix bug attempting to sync directories instead of files