Fixed the bug in excluding </head>