MATLAB to JSON bug - now handles Inf and NaN