Backported changes from syncfps.