Changed casting to native. More fixes