fixing some divide by zero errors