hash calculation fixes