Pull in Stephen's fixes