fix throwing undefined/null now makes tests fail, fixes #1395