dispose process in the right place