Fix JS errors and update some files