Bugfixes and some middleware improvements (no static file paths)