diff --git main/main-cocoa.m main/main-cocoa.m
index 6a7039fd..6265798a 100644
--- main/main-cocoa.m
+++ main/main-cocoa.m
@@ -51,17 +51,20 @@ int main(int argc, char* argv[])
       set_lang();
     }
 
-#ifdef COCOA_TOUCH
     const char *bundle = [[[NSBundle mainBundle] bundlePath] UTF8String];
     char *path;
 
+#ifdef COCOA_TOUCH
     if ((path = alloca(strlen(bundle) + 5))) {
       strcpy(path, bundle);
       strcat(path, "/etc");
       bl_set_sys_conf_dir(path);
     }
 #else
-    bl_set_sys_conf_dir([[[NSBundle mainBundle] bundlePath] UTF8String]);
+    if ((path = alloca(strlen(bundle) + 1))) {
+      strcpy(path, bundle);
+      bl_set_sys_conf_dir(path);
+    }
 #endif
   }
   @finally {
diff --git uitoolkit/quartz/ui_color.c uitoolkit/quartz/ui_color.c
index 2e01bda9..b0e853d3 100644
--- uitoolkit/quartz/ui_color.c
+++ uitoolkit/quartz/ui_color.c
@@ -51,7 +51,8 @@ int ui_load_named_xcolor(ui_display_t *disp, ui_color_t *xcolor, const char *nam
 
 int ui_load_rgb_xcolor(ui_display_t *disp, ui_color_t *xcolor, u_int8_t red, u_int8_t green,
                        u_int8_t blue, u_int8_t alpha) {
-  xcolor->pixel = (red << 16) | (green << 8) | blue | (alpha << 24);
+  xcolor->pixel = ((u_int32_t) alpha << 24) | ((u_int32_t) red << 16) |
+                  ((u_int32_t) green << 8)  | blue;
 
   return 1;
 }
diff --git uitoolkit/ui_screen_manager.c uitoolkit/ui_screen_manager.c
index 80bb8a9f..705dcf8a 100644
--- uitoolkit/ui_screen_manager.c
+++ uitoolkit/ui_screen_manager.c
@@ -1478,7 +1478,7 @@ void ui_close_dead_screens(void) {
         int count;
 
         for (count = MSU - 1; count >= 0; count--) {
-          if (dead_mask[idx] & (0x1 << count)) {
+          if (dead_mask[idx] & (0x1u << count)) {
             ui_screen_t *screen;
 
 #ifdef __DEBUG
