implement appcommand
fix bug