fixed bug in redirect logic for empty datasets