Fix broken references and missing open/closing group commands.
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>