fix bugs and remove old-style internal command