Fix hash calculation