Fix a fatal error when generating from a directory

Fixes #73