Fixed the capacitor dischage function