Improve condition to handle frozen hash