refine popen