Redirect route level and data availability

Hey guys,

I’m having some issues to redirect. Upon account creation, a user is redirected to /access and has to submit a valid code. If code is valid, user collection gets ‘submitted’ role. Then is redirected to /register to fill the registration form, upon submission, user gets ‘registered’ role.

The problem is that sometimes, I don’t get redirected probably because data is not available.

routes.js

    FlowRouter.route('/access', {
	name: 'code',
	triggersEnter: [checkDelegateStatus],
	action() {
		BlazeLayout.render('MainLayout', {
			main: 'SubmitCode'
		});
	}
    });

    FlowRouter.route('/register', {
	name: 'register',
	triggersEnter: [checkDelegateStatus],
	action() {
		BlazeLayout.render('MainLayout', {
			main: 'NewRegistration'
		});
	}
    });


    function checkDelegateStatus()
    {
	if (!Meteor.userId())
		FlowRouter.go('login');
	var id = Meteor.userId();

	if (!Roles.userIsInRole(id, 'submitted', 'default-group'))
		FlowRouter.go('/access');
	else if (!Roles.userIsInRole(id, 'registered', 'default-group'))
		FlowRouter.go('/register');
	else
		FlowRouter.go('/registration');
    }

What is the right way to redirect?

Thanks