Merge from roryk upstream