Bug fix in array access when assigning a reference to a scalar value