fixed divide by zero bug