fix sext and refactor