Fix coverity defects: Division or modulo by zero (DIVIDE_BY_ZERO)