Write protect fix

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