improve install sql, fix issue with not existing publication
Merge pull request #761 from ahilles107/plugins_fixes

improve install sql, fix issue with not existing publication