db function returns object instead of string