Backport BFI patches