Trying to determine why std ends up with nan