fixed downcast problem