Fixed error where a random object is passed into variable