fix, API method resourceIndex returns a ptrdiff_t. validity tested with -1.