merged from Tuan, fixed activation-deactivation issue