Server errors and templates

See commits. Review please.