javascript error fixes