Apply Ian's fixes