removed scalar assertion in castArray method