Removed some thread safety from file listing related APIs to avoid deadlocks.