fix javascript to match backend refactoring