guard against type errors