fixed bug in get_chunks