Fix hash of id crashing in cases where it is invalid