Use `stopifnot()` or the `assertthat` package to check that inputs are the expected classes. Follow up to #406