Merged from beta 2 upstream