backport pullrequest #33