Fix pending order bugs