Javascript working after shift change