check for empty gid as well