Merge pull request #185 from amikheychik/master

Fix a notice
Fixed issue with not working redirect
Simplified logic