fixed issue with references within wrap tag