revert momentum update, fix some bugs in margin call code