Fix derpy annotation handling and add Ref to the scala pool.