Backport Erubis/Tilt fixes from HEAD