Imported code from 1.14