Fixes from master and dev-freeze.

See commit log.