Fix a condition bug in incrementUid
More detailed error message