Corrected bug in update code for KNN