fix error for class cast