Fixed event JS bug