Kotlin main.kt window null error , 1.3 beta-1

Hi i can successfully use kotlin in my project everywhere exept Main.
It looks that window setter is never called.
I getting error :

kotlin.TypeCastException: null cannot be cast to non-null type apple.uikit.UIWindow
at iosa.Main.window(Main.kt:29)
at apple.uikit.c.UIKit.UIApplicationMain(Native Method)
at iosa.Main$Companion.main(Main.kt:35)
at iosa.Main.main(Main.kt)

Cinverted code:

@RegisterOnStartup
class Main protected constructor(peer: Pointer) : NSObject(peer), UIApplicationDelegate {

private var window: UIWindow? = null

override fun applicationDidFinishLaunchingWithOptions(application: UIApplication?, launchOptions: NSDictionary<*, *>?): Boolean {
    return true
}

override fun setWindow(value: UIWindow?) {
    window = value
    println("test")
}

override fun window(): UIWindow {
    return window as UIWindow
}

companion object {

    @JvmStatic fun main(args: Array<String>) {
        UIKit.UIApplicationMain(0, null, null, Main::class.java.name)
    }

    @Selector("alloc")
    @JvmStatic external fun alloc(): Main
}

}

When i leave main in java it works fine.

Dear TaMaX,

the window function should return an optional object.

override fun window(): UIWindow? {
    return window
}

Best Regards,
Kristóf

That was a case, thank You.