Revert "Revert "Revert "bug fix"""

This reverts commit 1360b9304068ba4e98e4c0a123c0aca7c82d6717.