Basename mystery and logging fix