Direct casting is wrong, but it works for now.