set_registers must pass the correct reference

The previous implementation was wrong.
Merge pull request #5 from kanzure/fix-set-registers

set_registers must pass the correct reference