fix divided by 0 bug