fixed cf function