Minor fixups

make api.resource throw a less confusing exception when given an identifier without enough tokens