copied from current version.