javascript error fixing