fixing possible division by 0