added debug mode;force led blink even without flag FLAG_SHOW_LIGHTS;optimized rule of app sorting.