Fix the elect cleanup bug