some formal changes (generally adding constness)
fixing Mac build
fixing error, wrong template method param.
Merge pull request #3057 from Adil-Ibragimov:adding-constness