Fix a bug caused by the key_index being changed after the thread called the blocking recv socket function.

Fix a bug caused by different length of hash caused by lack of MSB if 0.

Clean output on stdout.