Fix NameError + test

Fixes #17