Fixed errors on javascript