fixes typeerror seen in issue #35