fix: should use pairs instead of ipairs.