restore submitted template and fix error on main code to port on windows