added invalidation of arrays when type is invalid. this way we don't need to check the type for parameters