Fix bug in change_bin the Nsamp was being calculated as the length of a repeated vector rather than giving the vector itself