Fixed API redirect issue