fixed bugs, added redirect