Fix some unclear type castings and unreferenced variables.