Add more error checking to renderTemplate
Add error checking to saveHandler