fix a bug using sqlite