Fixed a bug in MRI routines.