Fixed last bug: now the solution obtained match the book's one.