Fixed issue #7

Fixed missing $type in RegistryWrite() and added a unit test for the
case