Fixed invalid access to an array ref