add iniDB_chunk
re factoring cast function