Improved reading values from registry