Fixed check for remote directories failing with existing but empty directories. Added more logging.