fix some counting issue

but still have differences with Sai's. Anyway big improvement for 30
rules!