Changed na to number of rows of xa not columns
Catch nans from probability overflow