Patch up NaN values in error bars

Fixes #485.