Fix multiple redirect issue