move stopifnot condition down