assuming that whenever err is non-nil, engine will be nil, that would work.