Fix crash at very high resource counts

Signed-off-by: GreatEmerald <pastas4@gmail.com>