fixed div by zero bug