Fixes incorrect parsing of media query blocks.

Manually applied @lohmander's patch from PR #25, which fixes the IE8 memory bug for me as well. Throwing in a PR so that this can potentially get merged in to master.