fix potential division by zero