small improvements on getting a value