fixing bug #5563 : adding DOCTYPE declaration and removing HTML code placed before it