fix bug reading image data; run pca before knn