added more logging to 'adding referrer' code, as it is unexpectedly throwing some exceptions