Fixed bugs in getting title and applying references