Fix bugs in app command