Use empty record instead of remove index directly and add compact method.