Added checks to avoid firing hash change twice