fix class cast exception
fix deftype, dynamic redefinition of deftypes is still not working everywhere