fix class cast error