Fixed the method toggle function