Remove .to_s and it works fine, they are stored as DWORDs in registry anyway.