[RFC] Some fixes and missing changes

This PR includes some fixes and missing changes from my previous PRs

Should fix #1178