Fix out-of-order restriction bug in trimmer