fixes #2838 Saving twice in the language manager throws javascript error

fixed the issue and committed code for review please check it.