bug fix in replaceBilinearTermsWithNewVariables, cleanup in solveBilinear.