removed stopifnot/stop, replaced with assert.