Fixed bug with invalid Javascript being generated.