Fix the division by zero problem

Without this patch have chance to a division by zero.