fix bug javascript