First attempt at fixing redirect loop (Issue #52)