Re-applying the changes from c6f28faca49cf9e4b109082d1515604562d8121a which were somehow not merged properly in c2c6a705f1240db8e871563d8f2ee185ab55147c.