Fixed IndexOutOfBoundException
fixed #4