Add some logging
Fix redirect bug