Code cleaning

fixed buggy javascript