read indexGroup from handle first to fix #6 (needs testing)