Added bugfic for nan values. This is in a branch because the base
library (obviously) needs to be changed as well first.