Fix bug, JS improvements