Backported tests form master.