Merged RF support from 1.6.4 branch.