Fix bug. Wrong resource id check