fixed bkgd counting bug starting from 0 not from 1