fixed division by 0 issue