Fixed the bug in calc of heu