More optimalizations and fix bug in webserver