Fixes issues that cropped up in conversion to coffeescript.