Bug fix for medit

- check for NaN not null