Fixed small bug generating double external_references