some optimisations
Merge branch 'master' into http_speedup