Merged with latest from v4.0