diff --git a/image.php b/image.php
index <HASH>..<HASH> 100644
--- a/image.php
+++ b/image.php
@@ -373,7 +373,7 @@ class Image {
 	**/
 	function captcha($font,$size=24,$len=5,
 		$key=NULL,$path='',$fg=0xFFFFFF,$bg=0x000000,$alpha=0) {
-		if ($len<4 && $len>23) {
+		if ($len<4 || $len>22) {
 			user_error(sprintf(self::E_Length,$len));
 			return FALSE;
 		}
@@ -381,7 +381,8 @@ class Image {
 		$fw=Base::instance();
 		foreach ($fw->split($path?:$fw->get('UI').';./') as $dir)
 			if (is_file($path=$dir.$font)) {
-				$seed=strtoupper(substr(uniqid(),-$len));
+				$seed=strtoupper(substr(
+					str_replace('.','',uniqid('',TRUE)),-$len));
 				$block=$size*3;
 				$tmp=array();
 				for ($i=0,$width=0,$height=0;$i<$len;$i++) {
Improve detection of acceptable limits in captcha() (Feature request #<I>)