Adapted to handle situations with pid(file) as source and host alias as destination.
Added debug messages.