Improve plugin loading so that plugins can be loaded even if readdir returns an incorrect type value.