Fix instant trade function and some little bugs