Fixed bugs in converting to annotation