Replaced some hacky casts with proper bitcasts.