DEX: fix bugs and add basis