Pull in BluBaron's fixes from last December before they go out of date.