handle status codes, get headers via HEAD request, fix tests