fix implicit downcasts