fixed the sort computation in KItem and AddInjection pass
Merge pull request #815 from yilongli/fixing-issue-781

fixing issue 781