fixed wrong if statement on check for directory