Fixed setting script generation. Also added javascript api to get settings.