fix includes in cumulative functions
better (i)nbtrue implementation, fix #660