Add remove nan funtion line

This problem was found by Wesley.
I added the remove nan line.