Fixes newly introduced bug with incorrect handling of nested tags