redirect logic fix