minor bug fix - nil = 0 for features
alg speedup