improve condition for hash check