Probably you can have only one callback if you set `resIndex` to -1 in the callback definition on line 390.