replacing exec with spawn