Port from 6.x -> 7.x