Fixed bugs related to casting and pointers.