Fixed --donotactivate switch. Code pulled from phippodoplis patch in comments.