Update heurisch.py

Corrected the cases causing assertion failures