Fix element JS bug