Fixed bugs in nifti --> JSON conversion