Add safe handling of select all with no elements