Fix 2 wrong template names
Clean up a few bugs in templates
Add more precise type info in method signatures + make template generator more robust