Fix loading plugins with no file extension

The name of the plugin was mangled if the plugin file had no extension
and it was also in a directory with a "." in the name (usually a hidden
directory).

fixes #1