added checks for divide by 0, temporary fix until update to liquidfun 1.0