fixed div by zero, and display error message