Fixed bug during autoload generator with files and target-dir set

This pull fixes issue #1504