Don't know, I neither have the code nor the time to download and play with it.
You should be able to trace through the code to figure out the main flow of control. If there's a problem with the logic (as your post suggests) then it should stand out.
Also, I suggest checking the errata page for your book. If there is a problem with the source code, it might be mentioned there.