Some of the switching function bugs are fixed.