Main fixes

I have tried to use the plugin, but i have found some problems.

I have fixed them and this is the fixed version.