Added some corrections to hash handling