fix cite and ref
end document is handled by templaet
Misc fixes