Properly preserve nesting of media blocks fixes #39