replaced assertions with K exceptions
Merge pull request #1101 from andreistefanescu/master

hack to handle bugs in AddInjections
Merge pull request #1097 from yilongli/fixing-issue-1088

replaced some assertions with K exceptions
various stuff