Removing wrong code and fixig tag and atts