added NaN debugging stuff