Fixed errors when called with non-object values