Fix some bugs in the bitcoin handler.