db: fix how the return values are casted