Re issue token on scope change. Fixed errors in code.