fixes to setting nbins dynamically for kweighted times (needs work!)