corrected the nvalue array to have n 1000