added directory check for name validation