fix zero division bug