Fixed bug with nested media queries when one of them was declared as a variable. Closes #1678