added some basic file and dir checking