Revert "Revert "More fixes""

This reverts commit 8b68c6a4529b54b13f09b2ac10eac277b2f256d5.