added test. improved array type generation