I would like to use dbtext to store a list of whitelisted gateways, but each time I load it I get a core segmentation fault.

Any ideas? Here is my gateways db file:
key_name(str) key_type(int) value_type(int) key_value(str)
gwip:1:0:a
gwip:1:0:b
gwip:1:0:c
gwcount:0:1:3

And in my config:
modparam("htable","htable","gateways=>size=4;dbtable=gateways;")
modparam("htable","db_url","text:///usr/local/etc/kamailio")

                while( $var(i) < $sht(gateways=>gwcount) ){
                        if( $sht(gateways=>gwip[$var(i)]) == $si ){
                                setflag(gateway);
                                xlog("ISFROMGW: request from IP $si matches $sht(gateways=>gwip[$var(i)]) ...\n");
                        }
                }

Do you see anything wrong with this setup?
-Eric