Fix typeof incorrectness

It should either be:
if(ko === undefined) ...
or
if(typeof(ko) === 'undefined')

but currently that line will never hit the throw statement.