diff --git a/ChangeLog.md b/ChangeLog.md
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -1,5 +1,9 @@
 # Revision history for ip2proxy
 
+## 3.2.1  -- 2024-12-04
+
+* Fixed boundary cases. Fixed IPv6 address error when using IPv4 BIN.
+
 ## 3.2.0  -- 2021-10-07
 
 * Added support for IP2Proxy Web Service.
diff --git a/IP2Proxy.hs b/IP2Proxy.hs
--- a/IP2Proxy.hs
+++ b/IP2Proxy.hs
@@ -1,7 +1,7 @@
 {-|
 Module      : IP2Proxy
 Description : IP2Proxy Haskell package
-Copyright   : (c) IP2Location, 2021
+Copyright   : (c) IP2Location, 2018 - 2024
 License     : MIT
 Maintainer  : sales@ip2location.com
 Stability   : experimental
@@ -117,7 +117,7 @@
     The 'getModuleVersion' function returns a string containing the module version.
 -}
 getModuleVersion :: String
-getModuleVersion = "3.2.0"
+getModuleVersion = "3.2.1"
 
 {-|
     The 'getPackageVersion' function returns a string containing the package version.
@@ -332,25 +332,33 @@
         
 search4 :: BS.ByteString -> Integer -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> IP2ProxyRecord
 search4 contents ipnum dbtype low high baseaddr indexbaseaddr colsize mode = do
+    let ipnum2 = if (ipnum == 4294967295)
+        then ipnum - 1
+        else ipnum
+    
     if indexbaseaddr > 0
         then do
-            let indexpos = fromIntegral (((ipnum `rotateR` 16) `rotateL` 3) + (toInteger indexbaseaddr))
+            let indexpos = fromIntegral (((ipnum2 `rotateR` 16) `rotateL` 3) + (toInteger indexbaseaddr))
             let low2 = readuint32 contents indexpos
             let high2 = readuint32 contents (indexpos + 4)
-            searchtree contents ipnum dbtype low2 high2 baseaddr colsize 4 mode
+            searchtree contents ipnum2 dbtype low2 high2 baseaddr colsize 4 mode
         else
-            searchtree contents ipnum dbtype low high baseaddr colsize 4 mode
+            searchtree contents ipnum2 dbtype low high baseaddr colsize 4 mode
 
 search6 :: BS.ByteString -> Integer -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> IP2ProxyRecord
 search6 contents ipnum dbtype low high baseaddr indexbaseaddr colsize mode = do
+    let ipnum2 = if (ipnum == 340282366920938463463374607431768211455)
+        then ipnum - 1
+        else ipnum
+    
     if indexbaseaddr > 0
         then do
-            let indexpos = fromIntegral (((ipnum `rotateR` 112) `rotateL` 3) + (toInteger indexbaseaddr))
+            let indexpos = fromIntegral (((ipnum2 `rotateR` 112) `rotateL` 3) + (toInteger indexbaseaddr))
             let low2 = readuint32 contents indexpos
             let high2 = readuint32 contents (indexpos + 4)
-            searchtree contents ipnum dbtype low2 high2 baseaddr colsize 6 mode
+            searchtree contents ipnum2 dbtype low2 high2 baseaddr colsize 6 mode
         else
-            searchtree contents ipnum dbtype low high baseaddr colsize 6 mode
+            searchtree contents ipnum2 dbtype low high baseaddr colsize 6 mode
 
 tryfirst myIP = do
     result <- try (evaluate (ipStringToInteger myIP)) :: IO (Either SomeException Integer)
@@ -523,5 +531,9 @@
                     else if ipnum >= fromV4Compatible && ipnum <= toV4Compatible
                         then do
                             return $ search4 contents ipnum (databasetype meta) 0 (ipv4databasecount meta) (ipv4databaseaddr meta) (ipv4indexbaseaddr meta) (ipv4columnsize meta) mode
-                        else do
-                            return $ search6 contents ipnum (databasetype meta) 0 (ipv6databasecount meta) (ipv6databaseaddr meta) (ipv6indexbaseaddr meta) (ipv6columnsize meta) mode
+                        else if (ipv6databasecount meta) == 0
+                            then do
+                                let x = "IPV6 ADDRESS MISSING IN IPV4 BIN"
+                                return $ IP2ProxyRecord x x x x x x x x x x x x x (-1)
+                            else do
+                                return $ search6 contents ipnum (databasetype meta) 0 (ipv6databasecount meta) (ipv6databaseaddr meta) (ipv6indexbaseaddr meta) (ipv6columnsize meta) mode
diff --git a/IP2ProxyWebService.hs b/IP2ProxyWebService.hs
--- a/IP2ProxyWebService.hs
+++ b/IP2ProxyWebService.hs
@@ -2,7 +2,7 @@
 {-|
 Module      : IP2ProxyWebService
 Description : IP2Proxy Haskell package
-Copyright   : (c) IP2Location, 2021
+Copyright   : (c) IP2Location, 2018 - 2024
 License     : MIT
 Maintainer  : sales@ip2location.com
 Stability   : experimental
diff --git a/LICENSE b/LICENSE
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
 MIT License
 
-Copyright (c) 2021 IP2Location.com
+Copyright (c) 2018 - 2024 IP2Location.com
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
diff --git a/ip2proxy.cabal b/ip2proxy.cabal
--- a/ip2proxy.cabal
+++ b/ip2proxy.cabal
@@ -10,7 +10,7 @@
 -- PVP summary:      +-+------- breaking API changes
 --                   | | +----- non-breaking API additions
 --                   | | | +--- code changes with no API change
-version:             3.2.0
+version:             3.2.1
 
 -- A short (one-line) description of the package.
 synopsis:            IP2Proxy Haskell package for proxy detection.
@@ -60,7 +60,7 @@
   -- other-extensions:    
   
   -- Other library packages from which modules are imported.
-  build-depends:       base >=4.9 && <=4.15, bytestring >=0.10 && <0.12, binary >=0.8.4 && <0.9, iproute >=1.7 && <1.8, aeson >=1.5 && <1.6, http-types >=0.12 && <0.13, http-client >=0.6 && <0.7, http-client-tls >=0.3 && <0.4, uri-encode >=1.5 && <1.6
+  build-depends:       base >=4.9 && <=4.21, bytestring >=0.10 && <0.13, binary >=0.8.4 && <0.9, iproute >=1.7 && <1.8, aeson >=1.5 && <2.3, http-types >=0.12 && <0.13, http-client >=0.6 && <0.8, http-client-tls >=0.3 && <0.4, uri-encode >=1.5 && <1.6
   
   -- Directories containing source files.
   -- hs-source-dirs:      
