Fix for issue #126 and a fix for the %f placeholder from the takeScreenshots filename option.

Fixes the issue #126.

Additional a fix for %f placeholder and a optimization ... see commit comments.