move the order check to the correct location