Merge "Add assertNotEmpty to avoid IndexError"