Added logdir check to debug mode