Document Generator bugfix + tests