Fix for register overwrite bug

When writing a masked value to a register only the masked bits should be
modified. Previously everything was modified.