fix bugs in Array