fix calcore bugs partly and add test script for calcore
Merge pull request #76 from tianweidut/fix-calcore

fix calcore bugs partly