diff --git a/Makefile b/Makefile
index 3fef7e9..8c09091 100644
--- a/Makefile
+++ b/Makefile
@@ -6,7 +6,7 @@ include common.mk
 
 FRECON_LITE ?= 0
 
-PC_DEPS = libdrm libpng libtsm
+PC_DEPS = libdrm libpng libtsm zlib
 ifeq ($(FRECON_LITE),1)
 FRECON_OBJECTS = $(filter-out %_full.o,$(C_OBJECTS))
 CPPFLAGS += -DFRECON_LITE=1
@@ -25,7 +25,7 @@ CPPFLAGS += -std=c99 -D_GNU_SOURCE=1
 CFLAGS += -Wall -Wsign-compare -Wpointer-arith -Wcast-qual -Wcast-align
 
 CPPFLAGS += $(PC_CFLAGS) -I$(OUT)
-LDLIBS += $(PC_LIBS)
+LDLIBS += $(PC_LIBS) -static -lm
 
 $(OUT)glyphs.h: $(SRC)/font_to_c.py $(SRC)/ter-u16n.bdf
 	$(SRC)/font_to_c $(SRC)/ter-u16n.bdf $(OUT)glyphs.h
diff --git a/common.mk b/common.mk
index 0f4458e..43038ce 100644
--- a/common.mk
+++ b/common.mk
@@ -311,7 +311,7 @@ endif
 # The same goes for CFLAGS.
 COMMON_CFLAGS-gcc := -fvisibility=internal -ggdb3 -Wa,--noexecstack
 COMMON_CFLAGS-clang := -fvisibility=hidden -ggdb
-COMMON_CFLAGS := -Wall -Werror -fno-strict-aliasing $(SSP_CFLAGS) -O1 -Wformat=2
+COMMON_CFLAGS := -Wall -fno-strict-aliasing $(SSP_CFLAGS) -O2 -Wformat=2
 CXXFLAGS += $(COMMON_CFLAGS) $(COMMON_CFLAGS-$(CXXDRIVER))
 CFLAGS += $(COMMON_CFLAGS) $(COMMON_CFLAGS-$(CDRIVER))
 CPPFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3
diff --git a/term.c b/term.c
index dc27b84..5b5f7bb 100644
--- a/term.c
+++ b/term.c
@@ -357,7 +357,7 @@ static void term_osc_cb(struct tsm_vte *vte, const uint32_t *osc_string,
 	char *osc;
 
 	for (i = 0; i < osc_len; i++)
-		if (osc_string[i] >= 128)
+		if (((char *)osc_string)[i] >= 128)
 			return; /* we only want to deal with ASCII */
 
 	osc = malloc(osc_len + 1);
@@ -367,7 +367,7 @@ static void term_osc_cb(struct tsm_vte *vte, const uint32_t *osc_string,
 	}
 
 	for (i = 0; i < osc_len; i++)
-		osc[i] = (char)osc_string[i];
+		osc[i] = ((char *)osc_string)[i];
 	osc[i] = '\0';
 
 	if (strncmp(osc, "image:", 6) == 0)
