added more checking to pca