Fixed some javascript related problems
Merge pull request #1000 from ostcar/javascript

Fixed some javascript related problems