bugfix + --template

New pull request in its own branch with doc fixed