   isLocalCollection = @collection._connection is null
 
   if Meteor.isServer or isLocalCollection
-    @collection.before.insert (userId = '0', doc) ->
+    @collection.before.insert (userId = systemId, doc) ->
       if createdAt
         doc[createdAt] = new Date
       if createdBy and not doc[createdBy]?
         doc[createdBy] = userId
 
-    @collection.before.update (userId = '0', doc, fieldNames, modifier,
+    @collection.before.update (userId = systemId, doc, fieldNames, modifier,
       options) ->
 
       $set = modifier.$set ?= {}

  createdBy: 'createdBy'
  updatedAt: 'updatedAt'
  updatedBy: 'updatedBy'

behaviour = (options = {}) ->

  {createdAt, createdBy, updatedAt, updatedBy} =
    _.defaults options, @options, defaults

  if ss?


      addAfDefs def if af?

    regEx = new RegExp "(#{SimpleSchema.RegEx.Id.source})|^#{systemId}$"

    if createdBy
      def = definition[createdBy] =
