better checking for divison by zero