Changes merged upstream.

See http://trac.wildfiregames.com/changeset/16079.