Added 3rd validation check

added active variable as global
added finish_active var at command end