pass parameter by ref instead of by val:

- fixes coverity issue 1212009 Big parameter passed by value
make sure parameter is not negative

- fixes coverity issue 1198843 Argument cannot be negative
make variable names consistent, migrate Plugins
consequently use emplace back instead of push