okay, I see what's wrong in your code. You didn't give sizes to labels and feats in L249 and L250. This works, but not the best way. If possible, please move L40-L45 outside this function, and use SGMatrix in params without &.