fix custom host/port
implement templates
more tests.. for errors