modified sqlitedal code