Fixed down casting of pointers