Type cast fixes