Fix potential JS bug