fix nbin not defined