thread refcount start at 1; added stat syscalls