Fixed processing script annotations and getting IDs of top level scope.