Fix const tag on auto-return-type functions

Now k_means compiles with optimization
Check for nullptrs when working with basestr
Merge branch 'master' of https://github.com/DaMSL/K3-Core