Renderer fixes

This PR fixes a bug introduced in #542. See commits for details.