fix bug with export in the new runcommand function