Some casting fixed