Default cwm runs in background while charging

I built cwm for my vitria and fixed most of the bugs but I have one annoying bug left, while charging(when off) cwm appears quickly and the device goes to the charging screen but cwm is still in the background running, and the buttons still control it.