Made identification of plugin directory slightly more robust