check dir instead of file