Write protect fix

This is a very important fix. TODO:

* [x] Fix all packages that fail
* [x] Test from scratch, make sure everything builds
* [ ] Test on other machines