added gzip + callbacks + bug fixes