Added getValueSafe function