Apply patch from 30c65aa49