diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3500bff3160feb6789b2a97cad02c660fc849b44..97ea8848425814a66a011aba2d104d9c39278ce4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -45,6 +45,7 @@ endif()
 
 if (CMAKE_CXX_COMPILER_ID STREQUAL Clang)
     set(CMAKE_COMPILER_IS_CLANG true)
+    set(CMAKE_COMPILER_IS_GNUCC false)
 endif()
 
 if (CMAKE_COMPILER_IS_GNUCC)
@@ -90,7 +91,8 @@ endif()
 if (TARGET_OS_DARWIN)
 # Mac ports get installed into /opt/local, hence:
     set (CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES} /opt/local/include")
-    set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I/opt/local/include -L/opt/local/lib")
+    set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I/opt/local/include")
+    set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L/opt/local/lib")
 endif()
 
 check_symbol_exists(MAP_ANON sys/mman.h HAVE_MAP_ANON)
@@ -143,8 +145,14 @@ endif()
 #
 # Perform build type specific configuration.
 #
-set (CMAKE_C_FLAGS_DEBUG "-ggdb -O0 -fexceptions -funwind-tables")
-set (CMAKE_C_FLAGS_RELWITHDEBUGINFO "-ggdb -O2 -fexceptions -funwind-tables -DNDEBUG -DNVALGRIND")
+if (CMAKE_COMPILER_IS_GNUCC)
+    set (CC_DEBUG_OPT "-ggdb")
+else()
+    set (CC_DEBUG_OPT "-g")
+endif()
+
+set (CMAKE_C_FLAGS_DEBUG "${CC_DEBUG_OPT} -O0 -fexceptions -funwind-tables")
+set (CMAKE_C_FLAGS_RELWITHDEBUGINFO "${CC_DEBUG_OPT} -O2 -fexceptions -funwind-tables -DNDEBUG -DNVALGRIND")
 set (CMAKE_C_FLAGS_RELEASE "-DNDEBUG -DNVALGRIND")
 
 #
@@ -298,7 +306,9 @@ if (TARGET_OS_DARWIN)
     set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fgnu-runtime")
 endif()
 
-set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pthread")
+if (CMAKE_COMPILER_IS_GNUCC)
+    set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pthread")
+endif()
 
 add_subdirectory(third_party)
 add_subdirectory(cfg)
diff --git a/connector/perl/lib/MR/IProto/Cluster.pm b/connector/perl/lib/MR/IProto/Cluster.pm
index d5f46b8bdeffe20e559bfb387157597e234762c9..b8b34b7d86c43e0415373beef2aead4f01f9ff0f 100644
--- a/connector/perl/lib/MR/IProto/Cluster.pm
+++ b/connector/perl/lib/MR/IProto/Cluster.pm
@@ -113,6 +113,11 @@ has _one => (
     lazy_build => 1,
 );
 
+has _server => (
+    is  => 'rw',
+    isa => 'Maybe[MR::IProto::Cluster::Server]',
+);
+
 has _ketama => (
     is  => 'ro',
     isa => 'ArrayRef[ArrayRef]',
@@ -145,9 +150,12 @@ sub server {
     my ($self, $key) = @_;
     my $one = $self->_one;
     return $one if defined $one;
-    my $method = $self->balance == RR ? '_balance_rr'
-        : $self->balance == KETAMA ? '_balance_ketama'
-        : '_balance_hash';
+    if($self->balance == RR) {
+        my $server = $self->_server;
+        return $server if $server && $server->active;
+        return $self->_server($self->_balance_rr);
+    }
+    my $method = $self->balance == KETAMA ? '_balance_ketama' : '_balance_hash';
     return $self->$method($key);
 }
 
diff --git a/debian/changelog b/debian/changelog
index 8830b142049eb836296e88575ca77eff113430fb..0731ef41fd22766d7fa9c2414b0435c7babf5568 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+tarantool (1.4.6+20120629+2158-1) unstable; urgency=low
+
+  * Some fixes for Objective C 2.0.
+
+ -- Dmitry E. Oboukhov <unera@debian.org>  Fri, 29 Jun 2012 21:58:42 +0400
+
 tarantool (1.4.6+20120629+2112-1) unstable; urgency=low
 
   * Package is built by gcc-4.7.
diff --git a/third_party/luajit/src/Makefile b/third_party/luajit/src/Makefile
index 28c16bd1fb7034d335fc11b8e6790f03d9a0a1fd..9777562b83463520f9cb57712fd5ad9bbd8b0a5a 100644
--- a/third_party/luajit/src/Makefile
+++ b/third_party/luajit/src/Makefile
@@ -220,8 +220,10 @@ TARGET_ALDFLAGS= $(LDOPTIONS) $(TARGET_XLDFLAGS) $(TARGET_FLAGS) $(TARGET_LDFLAG
 TARGET_ASHLDFLAGS= $(LDOPTIONS) $(TARGET_XSHLDFLAGS) $(TARGET_FLAGS) $(TARGET_SHLDFLAGS)
 TARGET_ALIBS= $(TARGET_XLIBS) $(LIBS) $(TARGET_LIBS)
 
-ifneq (,$(findstring stack-protector,$(shell $(TARGET_CC) -dumpspecs)))
-  TARGET_XCFLAGS+= -fno-stack-protector
+ifneq (,$(findstring gcc,$(TARGET_CC)))
+    ifneq (,$(findstring stack-protector,$(shell $(TARGET_CC) -dumpspecs)))
+        TARGET_XCFLAGS+= -fno-stack-protector
+    endif
 endif
 
 TARGET_TESTARCH=$(shell $(TARGET_CC) $(TARGET_ACFLAGS) -E lj_arch.h -dM)