Re-add clearing of the APP_CMD flag that somehow got lost.