Fixed a major bug on Content-Length and refactored it