Fixes to the log likelihood calculation

 - changed N_total to N_max
 - changed data_i to v_data
 - changed data_term to data_i
 - deployed Emyr's fix for the log likelihood calculation

**Note**: The fit breaks when the term added to the log-likelihood is smaller than -10<sup>16</sup>.