changes from v4.1.x branch, closes #40