Bug fix for likelihood calculation