Fixing invalidly nested HTML