better error templates and some small fixes