Fix type error crash

fixes #1511 on github

This probably wouldn't occur in production under normal circumstances,
but it's harmless to fix it.
Merge pull request #1512 from steventlamb/topic/fix_type_error_crash

Fix type error crash