Modified code from line 182 to fix error in module building from existing table. (How suggested by boblennes in #1001 issue)