Patches required from ruby2 web branch

Don't merge yet. Trying to get things working in ruby2 branch.