Revert pull request #851 until better solution found