Revert "Revert "bug patch""

This reverts commit 626b548f56c296a9abe5e9a544820e5afd44c927.