Fixing hash calculationi