fixed potential div by zero panic