fix for possible divsion by zero