diff --git a/Web/ClientSession.hs b/Web/ClientSession.hs
--- a/Web/ClientSession.hs
+++ b/Web/ClientSession.hs
@@ -4,7 +4,7 @@
 --
 -- Module        : Web.ClientSession
 -- Copyright     : Michael Snoyman
--- License       : SD3
+-- License       : BSD3
 --
 -- Maintainer    : Michael Snoyman <michael@snoyman.com>
 -- Stability     : Stable
diff --git a/c/helper.c b/c/helper.c
--- a/c/helper.c
+++ b/c/helper.c
@@ -101,7 +101,7 @@
 	 * Need to align to 16 bytes.
 	 */
 	totlen = len + 8;
-	totlen += 16 - (totlen % 16);
+	totlen += (- totlen) % 16;
 	tmp = alloca(totlen);
 	bzero(tmp, totlen);
 	get_hash((uint*) tmp, in, len);
@@ -115,7 +115,7 @@
 		memcpy(tmp + i, buff, 16);
 	}
 
-	encoded_len = (totlen + 2 - ((totlen + 2) % 3)) / 3 * 4;
+	encoded_len = ((totlen + 2) / 3) * 4;
 	out = malloc(encoded_len + 1);
 	out[encoded_len] = 0;
 	base64_enc(out, tmp, totlen);
@@ -136,7 +136,7 @@
 
 	if (! len % 4) return 0;
 	outlen = len / 4 * 3;
-	out = alloca(outlen + 16 - (outlen % 16));
+	out = alloca(outlen + (- outlen) % 16);
 
 	if (! base64_dec(out, in, len)) {
 		return 0;
diff --git a/clientsession.cabal b/clientsession.cabal
--- a/clientsession.cabal
+++ b/clientsession.cabal
@@ -1,5 +1,5 @@
 name:            clientsession
-version:         0.4.0.1
+version:         0.4.0.2
 license:         BSD3
 license-file:    LICENSE
 author:          Michael Snoyman <michael@snoyman.com>
