check if the work directory exists before executing commands
Don't lose changes in 3c268d3