fix nested and out of order