implement stoi primitive