hash-based workaround for #456. There are strange situations where this might introduce other bugs but they should be uncommon.