fix segfault #515
Merge branch 'bugs/515'
Merge branch 'master' into cc5