Fixed cast errors