fix dividing by 0 issue