Merge "Correct lastId on onCreate with unexpected state" into oc-dev