backport of version 1.2.0