fix divide-by-zero error