Fix table indexing bug in the module implementation