fix bug generating on empty sqlite table