Fixed bugs in the new :ref: directive syntax