pre exec, post exec functions
fixed bug with redir