Fix casts with const pointers