Fix database object generation, only add int ret to cmp() when its needed.