Fix bug javascript