Fix issue when ids list is empty.