diff --git a/lib/modules/Calendar.pmod/Event.pmod b/lib/modules/Calendar.pmod/Event.pmod
index baaef6e2dd6714bbd5645671ae9df6b0db6d7037..02afe1efb5a12f17cb08cfcd1d7004084f6c7fe9 100644
--- a/lib/modules/Calendar.pmod/Event.pmod
+++ b/lib/modules/Calendar.pmod/Event.pmod
@@ -89,7 +89,7 @@ class Event
 
    protected array(Event) cast(string to)
    {
-     if (to[..4]=="array")
+     if (to=="array")
        return ({this});
      return UNDEFINED;
    }
@@ -1405,7 +1405,7 @@ class SuperEvent
 
    protected array(Event) cast(string to)
    {
-     if (to[..4]=="array")
+     if (to=="array")
        return events;
      return UNDEFINED;
    }
diff --git a/lib/modules/Geography.pmod/Countries.pmod b/lib/modules/Geography.pmod/Countries.pmod
index cc8494f5dd2cf1c00fd0a302ad08224653e75f8b..7213ceebab3166ec55cef87c155555394d016ea6 100644
--- a/lib/modules/Geography.pmod/Countries.pmod
+++ b/lib/modules/Geography.pmod/Countries.pmod
@@ -378,7 +378,7 @@ class Country
    //!	@expr{country->name;@}.
    protected string cast(string to)
    {
-      if (to[..5]=="string") return name;
+      if (to=="string") return name;
       return UNDEFINED;
    }
 
diff --git a/lib/modules/Parser.pmod/XML.pmod/DOM.pmod b/lib/modules/Parser.pmod/XML.pmod/DOM.pmod
index b9eee78e7f93dd709c80c08672310bb51b7eb996..aadc58f96d1ad3c2265dc0b4cbfe66179799a5f0 100644
--- a/lib/modules/Parser.pmod/XML.pmod/DOM.pmod
+++ b/lib/modules/Parser.pmod/XML.pmod/DOM.pmod
@@ -96,7 +96,7 @@ class NodeList
   protected int _sizeof() { return get_length(); }
   protected array(Node) cast(string to)
   {
-    if(to[..4] == "array")
+    if(to == "array")
       return values(this);
     return UNDEFINED;
   }
@@ -165,7 +165,7 @@ class NamedNodeMap
   protected int _sizeof() { return get_length(); }
   protected mapping(string:Node) cast(string to)
   {
-    if(to[..6] == "mapping")
+    if(to == "mapping")
       return copy_value(map);
     return UNDEFINED;
   }
diff --git a/src/operators.c b/src/operators.c
index 655ce520e8791404f000d3d5943b96418790cc16..b2b8ed41ff24a17d0d7fd2d9cb2aedcb9cbacec5 100644
--- a/src/operators.c
+++ b/src/operators.c
@@ -505,7 +505,7 @@ PMOD_EXPORT void o_cast(struct pike_type *type, INT32 run_time_type)
 	f_object_program(1);
 	return;
       }
-      push_string(describe_type(type));
+      push_text(get_name_of_type(type->type));
       apply_low(o, f, 1);
 
       if (run_time_type == T_PROGRAM) {