diff --git a/compile_pkgs b/compile_pkgs
index 4a101f74f1a18a50ca62dc92caf120708112bbf7..b02e82f417e4a2b9d06f888248b5b4d4da0f2bef 100755
--- a/compile_pkgs
+++ b/compile_pkgs
@@ -227,7 +227,7 @@ EOF
 
 available_commands+=( ["checkout"]="Start everything from scratch - all changes deleted and fresh copy of OpenWRT gets checked out" )
 checkout() {
-	local target="${OPENWRT_BRANCH%#}"
+	local target="${OPENWRT_BRANCH#\#}"
 	report "Starting out: $target"
 
 	report "Checking out OpenWRT repository"