Fix errors in annotation viewer and code viewer