fixes infinite loop in some scenarios when hash contains equals