check for directory? may be unnecessary or flawed