Fix a particular bug that would consume a linear fact twice. Added test cases for that too.