fixes #3943 Script errors on Users page

Fixed the issue and committed code for review, please check it.