Remove duplicate dist call
Improve termination behavior