Debugged master.heuristic

I debugged master.heuristic function. Works now.