Javascript fixed up