fragments: ported changes from 4.5.x fragments