merge from trunk. changes how we obtain serial primary keys