Paranoid checks, will replace these with an assert instead.