you don't need these lf/rf = NULL things. these were needed to test if there are more features than kernels. you still have to do the test below in the lf !=NULL checks but by comparing if f_idx != num_feature_obj