manage staging directory properly