fix possible division by 0
fix possible division by 0