Fix cast class constructor