Fixed #1037 IndexOutOfBoundsException in backend
Added test for #1037