Fixed midstate hashing and more debugging information added