Fixed divide by zero bug