Extra type safeguards

I've seen errors where people have mixed up the types.