added environment to $cmd