Added debug messages and fixed NPE on disable.