work on API. fix ArrayIndexOutOfBoundsException