Clean up invalid markup