Updated directory check