fixed some redirect bugs #61