1.7.2 compat

Fixed bugs found after downgrading to 1.7.2 for the demo. These changes
didn't appear to cause issues in later versions, but are of better form
and are less likely to break in the future.