fixing NaN value when case is singular