dup2 fix