merged changes from bitcoin 0.7.2 branch, commit 65cee0b