OP-1139: fix wrong sign for bias and some optimizations

+review OPReview-598