Replacing nan with -inf