fixed bugs, the program is working but there's a problem with the log probability