Fixed a null pointer exception problem with the random environment
variable.