Fix indexing bug in JS.packages.