Fixed API endpoint issue

Fixed an issue where the client wasn't respecting the API endpoint
setting.