Fix wrong check when adding hash fragment