Added network error handling for linking and fixed import of API