Wip firefly 9419

This is a backport from master branch.