Merge pull request #3409 from Segrain/master

Bugfixes.
Runtime error fix.