Bugfix: write_mask() arguments were being passed in the wrong order