fix bug in unregister_from_filename()
Merge pull request #1173 from kived/factory-unregister

fix bug in unregister_from_filename()