fix getErrorTemplate() env vars
sort template vars
use fetchAll
add missing get/set methods