bugfix in linear coefficients. Added tests.