updated exception message
implemented toArray