Fix bug in RANDOM that can cause no key to be returned