Fixed the errors with javascript api.