[Editor Extension] Cast Error

I am trying to extend the editor and create a Blueprint with a custom actor parent class.

The menu extension button launches this code:

FString NameStr = "/Game/Blueprint";
UPackage* myPackage = CreatePackage(NULL, *NameStr);

AMyClass* myClass = NewObject<AMyClass>();

UBlueprintFactory* myFactory = NewObject<UBlueprintFactory>();

UBlueprint* myBP = Cast<UBlueprint>(myFactory->FactoryCreateNew(UBlueprint::StaticClass(), myPackage, FName("MyInfo"), RF_Public | RF_Standalone, NULL, GWarn));

	if (myBP)
		myBP->ParentClass = myClass->StaticClass();
		 //Notify the asset registry
		 //Mark the package dirty...

If I just use AActor as the parent class it works fine, so I guess the problem lies with my custom actor class.


UCLASS(Blueprintable, NonTransient)
class AMyClass : public AActor

AMyClass(const FObjectInitializer& ObjectInitializer);



AMyClass::AMyClass(const FObjectInitializer& ObjectInitializer)
	: Super(ObjectInitializer)

Everything compiles fine, but when I click the menu button I get the following error:

Cast of Package /Engine/Transient to Level failed

Any ideas as to why this is happening or how to fix?

Thanks in advance!