fix ArrayOutBoundException
simplify add method