First attempt at fixing redirect loop (Issue #52)

Fixes issue #52