fixed legion implementation