fix bug for ending and clean up commits