add null check for numwords