Hopefully fixed the pit detection bug.