move dup2 into child and fix order again