Test and fix for feature_gen() bug.

Closes #170.