Fixed merkle implementation to fit official algorithm.
.